﻿using System;
using System.Data;
using System.Collections.Generic;
using Chenxin.Lib.Hr.Entity;
namespace Chenxin.Lib.Hr.BLL
{
    /// <summary>
    /// 业务逻辑类Struct_AttendanceCircle 的摘要说明。
    /// </summary>
    public class Struct_AttendanceCircle
    {

        //Cache服务类
        private Chenxin.Lib.Cache.CacheService cs = new Chenxin.Lib.Cache.CacheService(Chenxin.Lib.Cache.CacheConn.xCacheConn.HR);

        public Struct_AttendanceCircle()
        { }
        #region  成员方法
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Chenxin.Lib.Hr.Entity.Struct_AttendanceCircle model)
        {
            Chenxin.Lib.Hr.DAL.Struct_AttendanceCircle.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Chenxin.Lib.Hr.Entity.Struct_AttendanceCircle model)
        {
            //考勤字典数据
            string strKeyAttendance = Chenxin.Lib.Cache.CacheDataType.HR_ATTENDANCECIRCLE;
            Chenxin.Lib.Hr.DAL.Struct_AttendanceCircle.Update(model);

            cs.Delete(strKeyAttendance);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(Guid RecordId)
        {
            //考勤字典数据
            string strKeyAttendance = Chenxin.Lib.Cache.CacheDataType.HR_ATTENDANCECIRCLE;
            Chenxin.Lib.Hr.DAL.Struct_AttendanceCircle.Delete(RecordId);

            cs.Delete(strKeyAttendance);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Chenxin.Lib.Hr.Entity.Struct_AttendanceCircle GetModel()
        {
            Chenxin.Lib.Hr.Entity.Struct_AttendanceCircle entAttendance;
            //考勤字典数据
            string strKeyAttendance = Chenxin.Lib.Cache.CacheDataType.HR_ATTENDANCECIRCLE;
            entAttendance = cs.GetObject<Chenxin.Lib.Hr.Entity.Struct_AttendanceCircle>(strKeyAttendance);
            //未命中
            //if (!cs.Hit)
            //{
                entAttendance = Chenxin.Lib.Hr.DAL.Struct_AttendanceCircle.GetModel();
                //添加到Cache中
                cs.Set(strKeyAttendance, entAttendance);
            //}
            return entAttendance;
        }

        #endregion  成员方法
    }
}

